package com.atech.ebayadmin.common.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.atech.ebayadmin.merchandise.dao.IMerchandiseDAO;
import com.atech.ebayadmin.merchandise.service.IMerchandiseService;
import com.atech.ebayadmin.system.service.ISystemService;

public class StaticObj {
    private transient final static Log log = LogFactory.getLog(StaticObj.class);
    public static final ApplicationContext appContext;
    public static final ISystemService systemService;
    public static final IMerchandiseService mdService;

    static {
        try {
            appContext = new ClassPathXmlApplicationContext(new String[]{
                    "spring/applicationContext.xml"
            });
        } catch (BeansException e) {
            log.error(e.getMessage(), e);
            throw new RuntimeException(e);
        }
   
        systemService = (ISystemService) appContext.getBean("systemService");
        mdService = (IMerchandiseService)appContext.getBean("mdService");
    }
}
